<?php


namespace app\admin\user\controller;


use app\admin\user\logic\UserLevelLogic;
use app\admin\user\validate\UserLevelValidate;
use app\common\controller\BaseAdminController;

/**
 * 用户等级管理
 * Class UserLevelController
 * @package app\admin\user\controller
 */
class UserLevelController extends BaseAdminController
{
    protected function init()
    {
        parent::init();
        $this->logic = new UserLevelLogic();
        $this->validate = new UserLevelValidate();
    }

    protected function searchWhere()
    {
        $where = [];
        $this->form['name'] && $where[] = ['name', 'like', "%" . $this->form['name'] . "%"];
        return $where;
    }

    public function getAllUserLevel()
    {
        $where = [
            'status' => 1
        ];
        $data = $this->logic->getList($where, [
            'id',
            'title',
        ]);
        return $this->success($data);
    }
}